package com.ysd.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.ysd.entity.GongSi;
import com.ysd.entity.JuTiXinWen;
import com.ysd.util.DBManager;

public class JuTiXinWenDaoImpl {
	public List<JuTiXinWen> getJuTiXinWen() {
		List<JuTiXinWen> JuTiXinWen = new ArrayList<JuTiXinWen>();
		Connection conn = DBManager.getConnection();
		Statement st = null;
		ResultSet rs = null;
		JuTiXinWen juTiXinWen = null;
		
		try {
			st = conn.createStatement();
			rs = st.executeQuery("select * from juTiXinWen");
			while(rs.next()) {
				int newsId =rs.getInt("newsId");
				String newsTitle = rs.getString("newsTitle");
				String newsContent = rs.getString("newsContent");
				Date faBuDate = rs.getDate("faBuDate");
				int xinWenId =rs.getInt("xinWenId");
				juTiXinWen = new JuTiXinWen(newsId, newsTitle, newsContent, faBuDate, xinWenId);
				JuTiXinWen.add(juTiXinWen);
			}
			return JuTiXinWen;
		} catch (SQLException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
			return null;
		}finally {
			DBManager.closeAll(conn, st, rs);
		}
	}
}
